//
//  Appconfig.swift
//  LeGou
//
//  Created by lxm on 2022/7/15.
//

import Foundation
@_exported import HandyJSON
@_exported import SwiftyJSON
@_exported import Kingfisher
@_exported import Alamofire

/**-------------------------------------------------------------------------------------------------------*/
// 是否是测试地址
// 上线打包注意事项:
// 1.查看appverfiy的时间
// 2.查看inviteUrl设置是否正确
// 3.检查域名
// 4.修改 THE_V
// 版本号
// 1.上线发布 2.测试--接口正式环境 3.测试--接口测试环境
var developMode = 1
// 是否要跳过广告测试用
var skipAd = false

var loginNoMD5 : String? = nil

var tradeNoMD5 : String? = nil

var baseUrl : String {
    get {
        if developMode == 1 || developMode == 2 {
//            return "http://112.126.66.117:8321"
            return DIS_BASE_URL
        }
        else {
//            return "http://192.168.31.109:8081"
//            return "http://192.168.101.127:8081"
//            return "http://192.168.0.110:8081"
//            return "http://192.168.110.129:8321"
//            return "http://192.168.31.114:8321"
            return DEV_BASE_URL
        }
    }
}

let DIS_BASE_URL = "http://m.dldskj.top"

let DEV_BASE_URL = "http://39.105.113.117:8081"

let THE_V = "172"

func getAppVerify() -> Bool {
//    return false
//    if developMode == 3 {
//        return false
//    } else {
        return !CommonService.shared.checkIsOk
//    }
}

// 密码正则表达式判断
var psd_regular : String?

var CONFIG_INVITEURL : String {
    get {
        if let userInfo = ZMAppShareData.share.userInfo.value {
            if developMode == 1 {
                return "http://share.dldskj.top?showId=\(userInfo.showId)"
            } else {
                return "http://sh.ynzxsc.com?showId=\(userInfo.showId)"
            }
        } else {
            return ""
        }
    }
}

/**--------------------------------------------------app内部配置-----------------------------------------------------*/
// 验证码长度
let CONFIG_CODE_LENGTH = 4
// 密码最短长度
let CONFIG_PSD_MIN_LENGTH = 8
// 密码正则
let CONFIG_PSD_REGULAR = "^(?=[A-Z a-z]*[\\d])(?=[\\d]*[A-Z a-z])[A-Z a-z \\d]{\(CONFIG_PSD_MIN_LENGTH),20}$"
 
let theKey = "124F126F62C8AAEB"
/**--------------------------------------------------三方登录方式及key-----------------------------------------------------*/
/// 三方登录方式
enum OtherLoginTyoe {
    case Phone
    case Apple
    case QQ
    case Wechat
}

var otherLoginType:OtherLoginTyoe = .Phone

let TitleBlindBox = AppHelper.stringConfuse(v:string_bbox)

/// 购物车数量
var shopCarNum = 1

let htmlUrl = "http://\(baseUrl)/api/front/appSet/html/"

/**QQkey*/
let QQAppID  = "1111162809"
let QQAppKey = "PcJZNQ5TNgQnM8Rz"
let QQuniversalLink = "https://www.zhonglb.com/qq_conn/1111162809"

/**微信key*/
let WeChatAppID = "wx62c736877b294e9e"
let WeChatAppSecret = "b3a1bc935a9ad25914ac8ba21fecaf53"
let WeChatuniversalLink = "https://49dbca858ce4f823ef1944db2d739b25.share2dlink.com/"

/**支付宝key*/
let AliAppID = "2021000193697598"
/**支付宝Scheme*/
let AliScheme = "legousafe"
/**高德*/
let amapKey = "e1b998038e7a5ad092623c9a24bed7d9"
/** 二维码 key*/
let qrKey = "jackslowfuckrose"


/** 多量 id*/
let CONFIG_GAME_CHANNEL = "408"
/** 多量 key*/
let CONFIG_GAME_KEY = "deee900e75154d7b87972504f9f79591"
// 生成多量h5链接
func getgameUrl(userId : Int) -> String {
    let sign = "\(CONFIG_GAME_CHANNEL)-\(CONFIG_GAME_KEY):sdkUserId=\(userId)&"
    let signMd5 = sign.zm.MD5().uppercased()
    return "https://sdkh5.gouzixsw.com/#/?channelId=\(CONFIG_GAME_CHANNEL)&userId=\(userId)&sign=\(signMd5)"
}
